<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model app\models\Land */

$this->title = $model->name;
//$this->params['breadcrumbs'][] = ['label' => '地块', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' =>$model->park->company->name, 'url' => ['company/view','id'=>$model->park->company->id]];
$this->params['breadcrumbs'][] = ['label' =>$model->park->name, 'url' => ['park/view','id'=>$model->park->id]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="land-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
           // 'id',
            'code',
            'name',
            'introduction:ntext',
            'scale',
            //'map_image',
            'tel',
            'email:email',
            'comment',
            ['label'=>'所属园区','value'=>$model->park->name,],
            ['label'=>'负责人','value'=>$model->pricipal->name,],
        ],
    ]) ?>

    <p>
        <?= Html::a('新增设备', ['/backend/equip/create', 'id' => $model->id], ['class' => 'btn btn-success']) ?>
    </p>

    <?= \yii\grid\GridView::widget([
        'dataProvider' => $dataProvider,
        //    'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'code',
            [
                'label'=>'设备类型',
                'value'=>function($data){
                    return $data->equipType->name_ch;
                }
            ],
           // 'equip_type_id',
            'comment',
            //'is_delete',

           //['label'=>'设备类别','value'=>$dataProvider->model->equipType->name_ch],
            ['class' => 'yii\grid\ActionColumn', 'template' => '{view} {delete}', 'controller' => 'equip'],
        ],
    ]); ?>

</div>
